#coding:utf-8
'''
create on 2017-08-22
@author:sandy
'''

import logging

from mj import mjConfig
from mj import mjMagicCheck
from mj import mjNormalCheck
class Check(object):
    
    def __init__(self):
        pass
    
    def randomMjs(self):
        cardIds = mjConfig.instance.getCardIds()
        mjList = []
        mjList.extend(cardIds)
        i = random.randint(1, 5)
        while i > 0:                  
            random.shuffle(mjList)
            i = i - 1  
        return mjList

    def checkPeng(self,mj,mjArr,magicCardId = 0):
        peng = False
        if magicCardId != 0:
            peng = mjMagicCheck.testPeng(mj,mjArr,magicCardId)
        else:
            peng = mjNormalCheck.testPeng(mj,mjArr)
        
        return peng

    def checkGang(self,mj,mjArr,magicCardId = 0):
        gang = False
        if magicCardId != 0:
            gang = mjMagicCheck.testGang(mj,mjArr,magicCardId)
        else:
            gang = mjNormalCheck.testGang(mj,mjArr)
        return gang

    def checkHu(self,mj,mjArr,magicCardId = 0):
        hu = False
        if magicCardId != 0:
            hu = mjMagicCheck.testHu(mj,mjArr)
        else:
            hu = True
        return hu

    

instance = Check()